#include "view_slider.h"
#include "ui_view_slider.h"

View_slider::View_slider(QWidget* parent) :
    QDialog(parent),
    ui(new Ui::View_slider)
{
    ui->setupUi(this);
    ui->spinBox->setMinimum(0);
    ui->spinBox->setMaximum(10);
    ui->spinBox->setSingleStep(1);
    ui->spinBox->setValue(5);

    ui->horizontalSlider->setMinimum(0);
    ui->horizontalSlider->setMaximum(10);
    ui->horizontalSlider->setSingleStep(1);
    ui->horizontalSlider->setValue(5);

    connect(ui->spinBox, SIGNAL(valueChanged(int)), ui->horizontalSlider, SLOT(setValue(int)));
    connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->spinBox, SLOT(setValue(int)));

}

View_slider::~View_slider()
{
    delete ui;
}

void View_slider::on_buttonBox_accepted()
{
    QString value = QString("%1").arg(ui->horizontalSlider->value());
    emit sendData(value);
    this->close();
}

